﻿using Autofac;
using System.Reflection;

namespace Cjj.Ocelot
{

    public class AutofacConfig : Autofac.Module
        {

            protected override void Load(ContainerBuilder builder)
            {
                //builder.RegisterType<FineexApiOperationFilter>().InstancePerLifetimeScope();
                //builder.RegisterType<HistoryConItem>().InstancePerLifetimeScope();
                //builder.RegisterType<CurrentConnDis>().InstancePerLifetimeScope();

                //builder.RegisterType<SqlSugarUnitOfWork>().As<ISqlSugarUnitOfWork>().InstancePerLifetimeScope();


                //builder.RegisterType<HelperMQ>().InstancePerLifetimeScope();
                //var iServices = Assembly.Load("FineEx.StoreBrandCore.Services");
                //var iRepository = Assembly.Load("FineEx.StoreBrandCore.Domain");
                //var repository = Assembly.Load("FineEx.StoreBrandCore.DAL");
                //var services = Assembly.Load("FineEx.StoreBrandCore.ServicesImpl");

                ////根据名称约定（服务层的接口和实现均以Service结尾），实现服务接口和服务实现的依赖
                //builder.RegisterAssemblyTypes(iServices, services)
                //   .Where(t => t.Name.EndsWith("Service"))
                //   .AsImplementedInterfaces();

                ////根据名称约定（数据访问层的接口和实现均以Repos结尾），实现数据访问接口和数据访问实现的依赖
                //builder.RegisterAssemblyTypes(iRepository, repository)
                //  .Where(t => t.Name.EndsWith("Repos"))
                //  .AsImplementedInterfaces();
               
            }

        }   
   
}